const App = {
  mixins: [Save],//配置文件，路径/utils/mixins.js
  data() {
    return {
      volunteer_teams: [],
      Recorder: [],
      city1: []
    };
  },
  mounted() {
    this.getCategory();
  },
  // watch:{
  //     'dataForm.News_Content'(val){
  //         console.log(val);
  //     }
  // },
  computed: {
    Personal_Name() {
      return function (val) {
        let obj = this.Recorder.filter(i => i.ID_Card_Number == val)[0];
        if (obj) {
          return obj.Personal_Name
        } else {
          return '';
        }
      }
    },
  },
  methods: {
    getCategory() {
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryByTableName`,
        type: "POST",
        data: {
          Data: 'volunteer_teams',
          Condition: "Row_Status='0'",
        },
        success: (data) => {
          this.volunteer_teams = data; // 直接使用 this
        },
        complete: (XMLHttpRequest) => {

          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryByTableNameWithOriginal`,
        method: "post",
        data: {
          Data: "personal_information", //表名
          Condition: "Row_Status='0'",
        },
        success: (res) => {
          this.Recorder = res;
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
      });
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/permissionsTree/getDistrictTreeByPermissions`,
        type: "GET",
        data: {
          DistrictCode: getCookie('village'), //请求参数
        },
        success:  (data)=> {
          this.city1 = data;
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
    },
    changeVillage(val) {
      this.dataForm.Province_Number = val.substring(0, 2) + '0000';
      this.dataForm.City_Number = val.substring(0, 4) + '00';
      this.dataForm.County_Nubmer = val.substring(0, 6);
      this.dataForm.Town_Number = val.substring(0, 9);
    },
    changeVolunteer(val) {
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
        method: "post",
        data: {
          SQLSerialNumber: "f_volunteer_teams_members",
          Condition: window.btoa(unescape(encodeURIComponent(val))),
          ExtensionCondition: ''
        },
        success: (res) => {
          this.childDataForm = res;
        },
        complete: (XMLHttpRequest) => {

          requestPretreatment(XMLHttpRequest);
        },
      });
    }
  },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus, { locale: zhCn });
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.component('yl-upload', ylUpload);
app.component('yl-text-editor', ylTextEditor);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
